package com.code.me

import android.content.Context
import android.graphics.Color
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.widget.ImageView
import android.widget.TextView
import com.bumptech.glide.Glide
import com.bumptech.glide.GlideBuilder
import com.bumptech.glide.Registry
import com.code.image.core.ImageOptions
import com.code.image.glide.AppGlideModuleIml
import com.code.image.glide.IAppGlideOptions
import com.code.image.load
import com.code.image.loadCircleImage
import com.code.image.loadRoundCornerImage

class MainActivity : AppCompatActivity() {

    var mUrl = "https://img0.baidu.com/it/u=3459825283,4188019193&fm=26&fmt=auto"

    private lateinit var mImageView: ImageView

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        mImageView = findViewById(R.id.iv)

        AppGlideModuleIml.options = object : IAppGlideOptions {
            override fun applyOptions(context: Context, builder: GlideBuilder) {
            }

            override fun registerComponents(context: Context, glide: Glide, registry: Registry) {
            }

        }

        findViewById<TextView>(R.id.tv).setOnClickListener {
            //mImageView.load(mUrl)
            //mImageView.loadCircleImage(mUrl, borderColor = Color.BLUE, borderWidth = 12)
            mImageView.loadRoundCornerImage(mUrl, radius = 140, type = ImageOptions.CornerType.ALL)
        }


    }

}